#! /bin/sh

dir=/data/src/java/LogSyncerClient/deploy



cd $dir

#svn up

for file in `ls *ProcessingFile.log`
do
	cat $file > ${file}.bak
	echo "bak file:"${file}
done

#stop program
echo "stop program..."
ps aux|grep LogSyncerClient.jar|grep java|awk '{print $2}'|xargs -t -i kill -9 {}

#start program
echo "start program..."
sleep 2
sh run.sh &

for bakFile in `ls *ProcessingFile.log.bak`
do
		file=`echo $bakFile|awk '{print substr($1,0,length($1)-4)}'`
		cat $bakFile > $file
		echo "rewrite file:"$file
done

echo "remove bakFile..."
rm -fr *ProcessingFile.log.bak

